<%@ page import="java.util.ArrayList" %>
<%@ page import="bean.Article" %>
<%@ page import="bean.Label" %><%--
  Created by IntelliJ IDEA.
  User: 蒋缇
  Date: 2020/10/15
  Time: 20:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page isELIgnored="false" contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    ArrayList<Article> articles=(ArrayList<Article>)request.getSession().getAttribute("userCategoryArticles");
    ArrayList<Label> labels=(ArrayList<Label>)session.getAttribute("userLabels");
%>
<html>
<head>
    <title>博客列表</title>
    <link rel="stylesheet"  href="css/bootstrap.min.css"/>
    <script src="js/jquery-3.1.1.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="css/allStyle.css">
</head>
<body>
    <div class="row">
        <div class="col-lg-3"></div>
        <div class="col-lg-6">
            <div class="panel panel-default">
                <div class="panel-body">
                        <%--时间选择--%>
                    <div class="row">
                        <ul class="list-group">
                            <%
                                for(Article article:articles){
                            %>
                            <li class="list-group-item" ondblclick="browseBlog('<%=article.getId()%>')">
                                <h4><%=article.getTitle()%></h4><hr><br><font style="font-size: 5px">作者：<%=article.getUser()%>时间：<%=article.getTime()%> 浏览数：<%=article.getViews()%>
                                类型：<%=article.getType()%></font></li>
                            <%
                                }
                            %>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-lg-3"></div>
    </div>
    <script type="text/javascript">
    function browseBlog(id){
        $.ajax({
                data: {'browseArticleId': id},
                dataType: 'text',
                type: 'post',
                url: '<%=basePath%>BrowseBlogServlet',
                success: function () {
                window.location = "<%=basePath%>blogPage.jsp";
                },
                error: function () {
                alert("查看失败")
                }}
        );}
    </script>
</body>
</html>
